package club.zhcs.capture.biz.auth.impl;

import java.util.List;

import club.zhcs.capture.bean.auth.UserRole;
import club.zhcs.capture.biz.auth.IUserRoleService;
import club.zhcs.capture.dao.IUserRoleDao;

import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;


@IocBean(name = "userRoleService")
public class UserRoleService implements IUserRoleService {
	@Inject
	IUserRoleDao userRoleDao;

	@Override
	public List<UserRole> findByUserId(int id) {
		return userRoleDao.search(Cnd.where("userId", "=", id));
	}

	@Override
	public UserRole addUserRole(UserRole ur) {
		return userRoleDao.save(ur);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.dgj.boss.service.auth.IUserRoleService#findByRoleId(int)
	 */
	@Override
	public List<UserRole> findByRoleId(int id) {
		return userRoleDao.search(Cnd.where("roleId", "=", id));
	}

}
